window.onload=function() {

    // get tab container
    var container = document.getElementById("tabMenu");
    // set current tab
    var navitem = container.querySelector(".tabs ul li");
    //store which tab we are on
    var ident = navitem.id.split("_")[1];
    navitem.parentNode.setAttribute("data-current",ident);
    //set current tab with class of activetabheader
    navitem.setAttribute("class","tabActiveHeader");
    container.setAttribute("display","none");
    //hide other tab contents
    var pages = container.querySelectorAll(".tabpage");
    for (var i = 1; i < pages.length; i++) {
      pages[i].style.display="none";
    }

    
    var tabs = container.querySelectorAll(".tabs ul li");
    var cur;
    for (var i = 0; i < tabs.length; i++) {
     cur=tabs[i].parentNode.getAttribute("data-current");
      
    }
}

function displayPage(tab, ident) {
//var current=tabHeader_3.parentNode.getAttribute("data-current");
var current = document.getElementById(tab).parentNode.getAttribute("data-current");


  //remove class of activetabheader and hide old contents
  document.getElementById("tabHeader_"+current).removeAttribute("class");
  document.getElementById("tabpage_"+current).style.display="none";
//  var ident = 3;
  
  
  //add class of activetabheader to new active tab and show contents
  document.getElementById(tab).setAttribute("class","tabActiveHeader");
  document.getElementById("tabpage_" + ident).style.display="block";
  document.getElementById(tab).parentNode.setAttribute("data-current",ident);
 
}

